/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.faytechcc.csc251.data;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 *
 * @author Joshua
 */
public class SFXTConnection {
    
    public static ResultSet getTable(String tableName)
    {
        String url = "jdbc:derby:SFXTCast";
        ResultSet results = null;
        
        try
        {
            Connection conn = DriverManager.getConnection(url);
            Statement stmt = conn.createStatement(
                    ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
            
            String selectStatement = "SELECT * FROM " + tableName; 
            
            results = stmt.executeQuery(selectStatement);
        }
        catch(Exception ex)
        {
            System.err.println("ERROR: " + ex.getMessage() );
            System.exit(0);
        }
        return results;
    }
}
